Adapt UI to both this repo's gateway and agentgateway/agentgateway - #4
Merged
Conversation
Introduces a backend adapter layer that allows the demo UI to work with multiple gateway implementations: - mcp-proxy (Python gateway, default) - agentgateway (Rust gateway) New file: demo/ui/backend.py - GatewayBackend abstract base class defining the interface - MCPProxyBackend: adapter for current Python mcp-proxy gateway - Uses JSON-RPC over /mcp/ with session management - Health check via /status - OAuth via /oauth/connect - AgentGatewayBackend: adapter for Rust agentgateway - Uses /config for health, /registry for tool definitions - Supports loading registry from gateway backend - Helper functions for registry format conversion between backends - load_registry_from_file() extracted from main.py Updated: demo/ui/main.py - Import and initialize backend based on GATEWAY_BACKEND env var - Replace direct gateway calls with backend adapter methods: - check_gateway_health() -> gateway_backend.check_health() - call_tool() -> gateway_backend.call_tool() - OAuth connect -> gateway_backend.connect_oauth() - Add "From Gateway" option in registry selector for agentgateway - Auto-load registry from agentgateway backend on startup - Display backend name in status badge (header) Configuration: - GATEWAY_BACKEND: "mcp-proxy" (default) or "agentgateway" - GATEWAY_URL: Backend URL (defaults vary by backend type) This enables the same UI codebase to be used with either the Python mcp-proxy or Rust agentgateway backend implementations.
Documents how to test the UI with both MCP Proxy (Python) and Agent Gateway (Rust) backends, including: - Required repositories and branches for each backend - Environment variable configuration - Feature differences between backends - Architecture overview of the backend adapter pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add multi-gateway backend support to Demo UI
Summary
Introduces a backend adapter pattern that allows the Demo UI to work with multiple MCP gateway implementations:
jakemannix/agentgatewayThis enables the same UI to be used for testing and demonstrating either gateway implementation by setting environment variables.
Changes
demo/ui/backend.py(new) - Backend adapter module with:GatewayBackendabstract base class defining the interfaceMCPProxyBackend- Implementation for Python mcp-proxy (/mcp/,/status,/oauth/connect)AgentGatewayBackend- Implementation for Rust agentgateway (/mcp,/config,/registry)get_backend()factory function usingGATEWAY_BACKENDenv varconvert_agentgateway_registry()- Format conversion (snake_case → camelCase)demo/ui/main.py- Refactored to use backend adapter:demo/ui/README.md(new) - Documentation covering:Configuration
Test plan
Start mcp-proxy gateway, verify UI connects and shows "MCP Proxy (Python) Connected"
Test tool listing and execution with mcp-proxy backend
Set GATEWAY_BACKEND=agentgateway, verify UI shows "Agent Gateway (Rust)" in status
Test "From Gateway" registry loading with agentgateway backend
Verify existing tests still pass (uv run pytest)